package com.hzit.loan.pay.commonApi.enums;

/**
 * 支付方式枚举
 */
public enum  PayWayEnum {

    ALIPAY_APP("alipay_app_pay","支付宝app支付"),
    WECHAT_SM("wechat_sm_pay","微信扫码支付"),
    ALIPAY_SM("alipay_sm_pay","支付宝扫码支付");


    private String code;

    private String desc;

    PayWayEnum(String code,String desc){

        this.code = code;
        this.desc = desc;

    }

    /**
     * 根据desc获取code
     * @param desc
     * @return
     */
    public String getCode(String desc){

        for ( PayWayEnum payWayEnum :PayWayEnum.values()){

            if(desc.equals(payWayEnum.getDesc())){
                return payWayEnum.getCode();
            }
        }

        return null;
    }

    /**
     * 根据code获取desc
     * @param code
     * @return
     */
    public String getDesc(String code){

        for ( PayWayEnum payWayEnum :PayWayEnum.values()){

            if(code.equals(payWayEnum.getCode())){
                return payWayEnum.getDesc();
            }
        }

        return null;
    }




    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }



}
